<template>
  <div class="table-wrapper">
    <el-table ref="multipleTable" :data="dataFilter" stripe>
      <el-table-column type="index" width="50" label="序号" align="center" fixed="left"/>
      <el-table-column prop="jobDesc" label="作业名称" align="center" />
      <el-table-column prop="ba" label="分类" align="center">
        <template v-slot="scope">
          <span>{{ scope.row.ba == 1 ? '上游依赖任务' : '下游任务' }}</span>
        </template>
      </el-table-column>
      <el-table-column label="调度类型" prop="taskScheduleType" width="auto" align="center">
        <template v-slot="scope">
          <span>{{ scope.row.taskScheduleType == 'batch' ? '周期' : '实时' }}</span>
        </template>
      </el-table-column>
      <el-table-column label="调度周期" prop="dependCycle" width="auto" align="center">
        <template v-slot="scope">
          <span>{{ getCycleLabel(scope.row.dependCycle) }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="triggerStatus" label="最新一次执行状态" align="center"/>
      <el-table-column prop="updateTime" label="最新一次执行时间" align="center" />
    </el-table>
  </div>
</template>

<script>
import {getCycleLabel} from './util'
export default {
  mixins: [],
  components: { },
  props: {
    data: { 
      type: Array, 
      default: ()=> {
        return [];
      } 
    }
  },
  computed: {
    dataFilter: {
      get () {
        return this.data.filter(item=> item.ba != '0')
      }
    },
  },
  data() {
    return {
      cols: [
        { label: '函数名称', prop: 'name', fixed: 'left' },
        { label: '函数分类', prop: 'category' },
        { label: '类型', prop: 'type' },
        { label: '子类型', prop: 'subtype' },
        { label: '适用版本', prop: 'version' },
        // {
        //   label: '是否启用',
        //   prop: 'enabled',
        //   formatter: (row) => {
        //     return row.enabled ? '已启用' : '未启用'
        //   }
        // },
      ]
    }
  },
  methods: {
    getCycleLabel,
  }
}
</script>

<style lang="scss" scoped>
.table-wrapper {
  height: 500px;
}

</style>
